import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

const actions = {
}
const mutations = {
  ADD_PERSON (state, value) {

    state.wholeData.unshift(value)

  },
  Change_PERSON (state, value) {

    for (let i = 0; i < state.wholeData.length; i++) {
      if (state.wholeData[i].num == value.num) {
        state.wholeData[i] = value
        break;
      }
    }
  },
}
// 首页的路由
const homeTopRoutes = [
  {
    title: "关于GIA",
    route: "/about",
    children: [
      {
        title: "GIA简介",
        to: "/GIA_redirect"
      },
      {
        title: "组织机构",
        to: "/institutionalFramework"
      },
      {
        title: "联系我们",
        to: "/connectUs"
      },
      {
        title: "学会宗旨章程",
        to: "/purpose_charter"
      }
    ]
  },
  {
    title: "新闻",
    route: "/news",
    children: [
      {
        title: "GIA新闻",
        to: "/GIA_redirect"
      }
    ]
  },
  {
    title: "会员",
    route: "/member",
    children: [
      {
        title: "个人会员",
        to: "/individual_member",
      },
      {
        title: "单位会员",
        to: "/group_member",
      },
      {
        title: "如何加入",
        to: "/how_join"
      }
    ]
  },
  {
    title: "活动",
    route: "",
    children: [

    ]
  },
  {
    title: "分支机构",
    route: "",
    children: [

    ]
  },
  {
    title: "服务机构",
    route: "",
    children: [

    ]
  },
  {
    title: "奖励",
    route: "",
    children: [

    ]
  },
  {
    title: "合作",
    route: "",
    children: [

    ]
  }
]


const state = {
  // 首页头部路由数据
  routerlist: homeTopRoutes,
  userInfo: { sex: {} },//当前用户信息
  userInfo_canWrite: {
    sex: {}
  },// 可修改的信息
  user: {},
  registerUserRes: [],//待审批的注册用户
}
const getters = {
}

//创建并暴露store
export default new Vuex.Store({
  actions,
  mutations,
  state,
  getters
})